package com.zjitc.controller;

import com.zjitc.model.Product;
import com.zjitc.service.ProductService;
import javax.jws.WebParam.Mode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * Created by LWW on 2018/4/19.
 */
@Controller
public class IndexController {
    @Autowired
    private ProductService productService;

    @RequestMapping("/index")
    public String index(Model model){
        List<Product> nest=productService.findNewProduct();
        List<Product> hots=productService.findHotProduct();
        model.addAttribute("nest",nest);
        model.addAttribute("hots",hots);
        return "/jsp/index.jsp";
    }
}
